package com.zerowidth.moc.web.resp.helper;

import com.zerowidth.moc.web.resp.ResultBean;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

public class ResponseCreator {

    public static <T> ResponseEntity<ResultBean<T>> creatOk(T t, int code, String msg) {
        return create(t, code, msg, HttpStatus.OK);
    }

    public static <T> ResponseEntity<ResultBean<T>> create(T t, int code, String msg, HttpStatus status) {
        ResultBean<T> resultBean = new ResultBean<>();
        resultBean.code = code;
        resultBean.message = msg;
        resultBean.data = t;
        return new ResponseEntity<>(resultBean, status);
    }

}
